package com.zjj.distributed.zk.microservice.consumer.service;

import com.zjj.distributed.zk.microservice.consumer.entity.OrderEntity;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @author zhanglei.zjj
 * @description 订单服务
 * @date 2023/6/22 20:55
 */
@Service
public class OrderServiceImpl implements OrderService {
    @Override
    public List<OrderEntity> listByUserId(Integer userId) {
        OrderEntity oder1 = OrderEntity.builder()
                .id(1)
                .userId(userId.toString())
                .commodityCode("no.1")
                .amount(100)
                .count(1)
                .build();
        OrderEntity oder2 = OrderEntity.builder()
                .id(2)
                .userId(userId.toString())
                .commodityCode("no.2")
                .amount(44)
                .count(2)
                .build();
        return new ArrayList<>(Arrays.asList(oder1, oder2));
    }
}
